private async Task ParseRawTile(PipeReader uncompressedReader, byte[] data, int x, int y, int tileWidth, int tileHeight, int rectangleWidth) { int tx = 0; int ty = 0; await uncompressedReader.ForEach(3, tileWidth *tileHeight, (mem) => { var dataIndex = (((y + ty) * rectangleWidth) + x + tx) * 4; data[dataIndex] = mem.Span[0]; data[dataIndex + 1] = mem.Span[1]; data[dataIndex + 2] = mem.Span[2]; data[dataIndex + 3] = 0xff; tx += 1; if (tx >= tileWidth) { tx = 0; ty += 1; } }); }