Cross-Trajectory Representation Learning for Zero-Shot Generalization in RL