             }
         }
 
-        updateChanges.newImage = terrainImage.GetSubimage(IntRect(updateChanges.offset.x, updateChanges.offset.y, updateChanges.offset.x + brushImageWidth, updateChanges.offset.y + brushImageHeight));
+        updateChanges.newImage = terrainImage.GetSubimage(boundsRect);
     }
 
     private void UpdateTerrainSetConstantHeight(Image@ terrainImage, float height)

        uint brushImageHeight = scaledSelectedBrushImage.height;

        updateChanges.offset = IntVector2(position.x - (brushImageWidth / 2), position.y - (brushImageHeight / 2));
        updateChanges.oldImage = terrainImage.GetSubimage(IntRect(updateChanges.offset.x, updateChanges.offset.y, updateChanges.offset.x + brushImageWidth, updateChanges.offset.y + brushImageHeight));

        // lower or raise (respectively), multiply this by the brush opacity
        float opacity = brushOpacitySlider.value / 25;

        uint brushImageHeight = scaledSelectedBrushImage.height;

        updateChanges.offset = IntVector2(position.x - (brushImageWidth / 2), position.y - (brushImageHeight / 2));
        if (updateChanges.offset.x < 0) updateChanges.offset.x = 0;
        if (updateChanges.offset.y < 0) updateChanges.offset.y = 0;

        IntRect boundsRect = IntRect(updateChanges.offset.x, updateChanges.offset.y, updateChanges.offset.x + brushImageWidth, updateChanges.offset.y + brushImageHeight);
        boundsRect = ClipIntRectToHeightmapBounds(terrainImage, boundsRect);

        updateChanges.oldImage = terrainImage.GetSubimage(boundsRect);

        float targetHeight = brushHeightSlider.value / 25;

