ast: Better simplification for Box regions

Use a more robust algorithm for determining the order of the
vertices whan a Box is simplified to a Polygon. The old method
sometimes resulted in an unbounded "inside-out" polygon.