maximum square inside a contour