This will be used to merge overlapping rectangles in order to avoid copying the same rectangles multiple times.