public static Point ConvertPoint(int pos, int tileW, int tileH) { Point p = new Point(); int y = pos / tileH; int x = pos < tileW ? pos : pos - (tileW * y); p.X = x * tileW; p.Y = y * tileH; return p; }