Applying Quaternion rotation to a cube

here is what i have so far

Originally the cube was just rotating along one of the 3 axis depending on what mousebutton i clicked. I have the functions for the trackball, now i just need help using what i have to apply it to my cube. I believe i need to change my colorcube function for this. Any pointers would be great.