                     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)
                 )
             }
             

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

        
        if !need_to_render.isEmpty {
            
            let textures: [(Block, MTLTexture)] = need_to_render.compactMap { block in
                
                let extent = Rect(x: block.minX, y: block.minY, width: block.width, height: block.height)
                
                let buffer = MappedBuffer<UInt8>(repeating: 0, count: block.width * block.height * 4, fileBacked: true)
                
                let descriptor = MTLTextureDescriptor.texture2DDescriptor(
                    pixelFormat: .bgra8Unorm,
                    width: block.width,
                    height: block.height,
                    mipmapped: false)
                descriptor.usage = .shaderWrite
                
                guard let texture = commandBuffer.device.makeTexture(buffer, descriptor: descriptor, bytesPerRow: block.width * 4) else { return nil }
                
                renderer.render(image, to: texture, commandBuffer: commandBuffer, bounds: CGRect(extent), colorSpace: workingColorSpace)
                
                #if os(macOS) || targetEnvironment(macCatalyst)
                
                if texture.storageMode == .managed {
                    let blitCommandEncoder = commandBuffer.makeBlitCommandEncoder()
                    blitCommandEncoder?.synchronize(resource: texture)
                    blitCommandEncoder?.endEncoding()
                }
                
                #endif
                
                return (block, texture)
            }
            
            for (block, texture) in textures {
