Added rect function for drawing rectangles.