Replace tuple with Rect<f32>
Also includes other minor code cleanup.