Three-Dimensional Vortex Dynamics in a Shear-Driven Rectangular Cavity