THz-based phase-space manipulation of electron bunches