You would rotate the image or video on the "Y" axis. Adding a custom animation. You would place the playhead to the left of the animation arrow. Rotate the image in the properties panel using "Y" rotation.
Then, move the playhead to the right side of the arrow.Make another rotational adjustment in the other direction.
How much rotation is applied is up to you. That's the process in a nutshell.