wrote invert for a mosaic