How should I modify a rotated rectangle to pass it to groupRectangles?

Well, that would remove duplicates. But it wouldn’t merge nearby/overlapping rectangles. Is there a way to combine rectangles?