private static SKBitmap[] LoadTiles(SKBitmap texture, int frameCount) { var src = new SKRectI(0, 0, texture.Width / frameCount, texture.Height); var tileInfo = texture.Info.WithSize(src.Width, src.Height); Debug.Assert(tileInfo.RowBytes == src.Width * texture.Info.BytesPerPixel); var ret = new SKBitmap[frameCount]; for (int i = 0; i < frameCount; i++, src.Offset(src.Width, 0)) { var tile = new SKBitmap(tileInfo); if (!texture.ExtractSubset(tile, src)) { throw new InvalidOperationException($"Failed to extract tile {i} from texture {texture}"); } tile.SetImmutable(); ret[i] = tile; } return(ret); }