Geometrically controlled ratchet effect with collective vortex motion