To better understand how Quaternions work I would recommend learning how complex numbers can be used to represent rotation in 2D.

http://www.euclideanspace.com/maths/algebra/realNormedAlgebra/complex/transforms/

Complex numbers are kinda like the 2D equivalent of Quaternions. The same basic operations can be done with complex numbers as can be done with Quaternions only they are much simpler to comprehend. Once you understand how to manipulate 2D using complex numbers.