I would do something like this:
- List all the sides. A side is defined by two pairs of coordinates.
- If any side shows up more than once remove all instances of that side.
- Pick an arbitrary side, and from that side choose one of its points.
- Place that point in an array.
- Follow the current side and put the other point in the array.
- Delete the side you just followed.
- Then find the other side that has a point that is the same as the last point in the array. There will be only one such side. If there is none, you're done.
- Go back to step 5.
You should now have an array of points that make up, in order, the shape you want.
Just be aware that this won't handle holes. The shape must be defineable by a single path.