Possibly found a simpler way without a custom function.

Use the Rotate About Axis Node and just set the Axis you want to rotate around (vertical is Y) to 1 and others to 0.

Connect the ViewDirection Node to the In and the Out to the SampleCubeMap ViewDir.