The answer implies the following rule, which, in my opinion, is necessary in any case:
The user can only split an existing rectangle using a horizontal or vertical line.
This means that in your first example, the division order should be:
Brown, yellow, blue.
For any rectangle class you use, define two extension methods: SubdivideHorizontal and SubdivideVertical , which will take the coordinate of the subsection and return two resulting division rectangles.
For each rectangle that you split, replace it with two resulting dividing rectangles and repeat recursively for all divisions.
Rotem
source share