paintMatrix, Rect.shiftedBy, type annotations