>>12289278So the side length of the black square in the middle is the only variable then?
Just make a function for the areas of all red figures in terms of that variable, find all values for the variable where the first derivative is zero, and see which of those values has the largest area.