Dividing surfaces into rectangular areas

Hello!

I hope somebody can guide me in the correct direction with the following problem -
I have a surface.

It needs to be divided into smaller rectangles, where main criteria - smaller rectangles are as large as possible along horizontal lines.

Idea is that this surface is area of three layer precast wall. And I’m trying to find areas where I need to insert vertical ties through insulation layer.

With these rectangles I’d find what kinda length is necessary for the ties.

Problem is that the contour curve can be with any kinda geometry (though the lines will be orthogonal), and there can be varying number and sizes of windows/doors.

What I’m thinking of doing currently -
somehow find the points of all the horizontal lines within surface. Sort them and reconstruct the rectangles from that.

But maybe Grasshopper has some kinda inbuilt function regarding this?
(Currently I’m still on the step of figuring out how extract horizontal lines, and divide them by “contour line” and “windows”.)

Best regards,
Janis