Merge overlapping boxes