Calculate a maximum set of non-overlapping rectangles