substitute rectangles with images