Counting oriented rectangles and the propagation of waves