We could also approach this analytically. (My visual instinct sucks, so my geometry solutions are always slipping into algebra; I wouldn't have been able to hack it in ancient Greece.)
Fix the rectangle in the coordinate plane with one vertex at the origin and its opposite at (6, 8). The diagonal is the line y = (4/3)x, so any point on the diagonal has coordinates (x, (4/3)x).
Now consider what happens as we move (x, (4/3)x) from (0,0) to (6,8). Every time either x or (4/3) passes a new integer value, we'll be in a new square. (For instance, when we hit (3/4, 1), we'll be on the border of a new square, and when we hit (1, 4/3), we'll be on the border of another.)
That means we need only count the number of times x and (4/3)x pass new integer values INSIDE THE RECTANGLE (i.e. not at (0,0) or when we arrive at (6,8)). x will do this 5 times (at 1, 2, 3, 4, and 5) and y will do this 7 times (at 1, 2, 3, 4, 5, 6, and 7), so we'll pass through 5 + 7 = 12 squares.