public static Point[] GetPoints(this Rectangle r) { Point[] ps = new Point[4]; ps[0] = new Point(r.X, r.Y); ps[1] = new Point(r.X + r.Width, r.Y); ps[2] = new Point(r.X + r.Width, r.Y + r.Height); ps[3] = new Point(r.X, r.Y + r.Height); return ps; }