Finidng edges of convexhull from rectangles
If you have $n$ rectangles, take the convex hull of the $4n$ points given by the corners of those rectangles.  This gives you exactly what you want, and you can use any standard algorithm for computing the convex hull.  There is no need to explicitly deselect individual corners -- let the algorithm for computing a convex hull take care of that.