What are they? Polylines? Blocks? Sets of 4 Lines? Something else? Are they always orthogonally oriented, or could they be at any angle(s)? If they're Polylines, are they "closed" as AutoCAD defines the word? And could there be other closed 4-vertex line-segment-only Polylines that are not rectangular and should not be processed? Should there be a test for whether or not each is rectangular? How could a routine decide which direction in them should be changed to which specified dimension? Probably other questions will arise -- a representative sample of the possible range of conditions would be useful.
Kent Cooper, AIA