Implement Rotary Position Embedding (RoPE), which encodes position by rotating pairs of dimensions in the embedding vector.