                     from: texture,
                     sourceSlice: 0,
                     sourceLevel: 0,
-                    sourceOrigin: MTLOrigin(x: offset_x, y: offset_y + block.height - height, z: 0),
+                    sourceOrigin: MTLOrigin(x: offset_x + _minX - block.minX, y: offset_y + _minY - block.minY, z: 0),
                     sourceSize: MTLSize(width: width, height: height, depth: 1),
                     to: output,
                     destinationSlice: 0,
                     destinationLevel: 0,
-                    destinationOrigin: MTLOrigin(x: _minX, y: _minY, z: 0)
+                    destinationOrigin: MTLOrigin(x: _minX - minX, y: _minY - minY, z: 0)
                 )
             }
             

        var need_to_render: [Block] = []
        var blocks: [(Block, (MTLTexture, Int, Int))] = []
        
        let _minX = minX / blockSize * blockSize
        let _minY = minY / blockSize * blockSize - blockSize
        
        for y in stride(from: _minY, to: maxY, by: blockSize) {
            for x in stride(from: _minX, to: maxX, by: blockSize) {
                
                let block = Block(x: x, y: y, width: blockSize, height: blockSize)
                

            
            for (block, (texture, offset_x, offset_y)) in blocks {
                
                let _minX = max(block.minX, minX)
                let _minY = max(block.minY, minY)
                let _maxX = min(block.maxX, maxX)
                let _maxY = min(block.maxY, maxY)
                
                let width = _maxX - _minX
                let height = _maxY - _minY
