# Counting problem involving 3D rotation

While in college some years ago, I received the quiz below from a professor. I managed to solve this through brute force counting, but I'm wondering how I could have solved this in a more elegant way.

Imagine that you have a cube with $8$ corners, and that you have three colors. You need to color every corner, but not all colors have to be used.

First level: In how many ways could you color the cube's corners? (easy: $3^8 = 6561$.)

Second level (the question): In how many different ways could you color the cube's corners if you consider rotation; i.e., if you can rotate one cube in 3D-space to become another one, it should only be counted once.

What is the best method to solve the second level part of the quiz? (If I'm not remembering this incorrectly, the correct answer is that there are $333$ unique cubes.)