private static Rect GetBounds(IEnumerable<Vector2> poly) { float bx1 = poly.Min(p => p.x); float by1 = poly.Min(p => p.y); float bx2 = poly.Max(p => p.x); float by2 = poly.Max(p => p.y); return new Rect(bx1, by1, bx2 - bx1, by2 - by1); }