Fixed repainting issues when using tiles smaller than the grid size

The small tiles could cause the bounding rect of the brush preview to
become too small for painting its region as tile selection.