I have a number of possibly overlapping rectangles, of random size and position within a fixed plane. Since these rectangles are random, some may not overlap:
|-----
First create the set of all "atomic" rectangles in the composition, i.e. areas formed by the rectangle intersections and not being subdivided themselves. Every actual rectangle covers 1 or more atomic rectangles. Then run a combinatorial optimization algorithm e.g. SETCOVER to calculate the minimum number of rectangles you need to cover them all.
Here an illustration of the approach. You have three rectangles (A,B,C). They create 5 atomic regions (1-5):
+---------+A
| 1 |
| +----+-----+B
| | 2 | 3 |
| | +-+---+C|
| | |4| | |
+----+--+-+ 5 | |
| +-----+ |
+--+-------+
The rectangles cover the atomic regions according to this table:
A {1,2,4}
B {2,3,4,5}
C {4,5}
The SETCOVER problem is now to select a minimal subset of the rectangles {A,B,C} so that all the atomic regions are covered when you put together the atomic regions covered by the rectangles. The minimal solution is (obviously)
A {1,2,4} + B {2,3,4,5} = {1,2,3,4,5}
Note that here the areas are non-rectangular, e.g. area 3 has a complex shape. You can get rid of this problem by the following approach: take all the distinct X-coordinates of the corner points of the original rectangles and consider them as X-coordinates of a grid and do the same thing for the Y-coordinates; then every rectangle covers a set of grid squares which are never subdivided, i.e.:
+---------+A -
| 1 |
| +----+-----+B -
| | 2 | 3 |
| | +-+---+C| -
| | |4| | |
+----+--+-+ 5 | | -
| +-----+ | -
+--+-------+ -
| | | | | |
Which gives you the following 5x5 grid:
AAA A = rectangle A only
A**BB B = rectangle B only
A*#CB * = A and B
BCCB C = rectangles C and B
BBBB # = All
From this you can easily extract the 5 regions; as a matter of fact, they have been already marked :) (A,B,C,*,#)