public Func<Vector2, int, Vector2> BuildTransform(Size[] maps) { int width = (int)(Math.Ceiling(Math.Sqrt(maps.Length))); Size size = new Size(maps.Max(m => m.Width), maps.Max(m => m.Height)); Size full = new Size(size.Width * width, size.Height * width); return (p, i) => { int x = i % width; int y = (int)Math.Floor(i / (double)width); int xo = x * size.Width; int yo = y * size.Height; return new Vector2( (xo + p.X * maps[i].Width) / (float)full.Width, (yo + p.Y * maps[i].Height) / (float)full.Height ); }; }