Call a quaternion whose scalar part is zero a vector quaternion. We shall denote the vector quaternions as $\mathbb R^3$. Given $q = w + xi + yj + zk$, we shall define $q^*$ (called the "conjugate" of $q$) to be $w - xi - yj - zk$.

If $q$ is a unit quaternion, then $v \in \mathbb R^3\mapsto qvq^*$ is a rotation. All rotations about the origin in 3D can be given in this form.

If $q$ is a general (i.e. not necessarily a unit) quaternion, then $v \mapsto qvq^*$ is a rotation followed by a dilation from the origin by $|q|^2$ units.

Finally, add a vector quaternion $x$ to perform a translation. We thus get $v \mapsto qvq^* + x$ as a general form for similarity transformations.

Postscript: This can be generalised to higher dimensions, and some non-Euclidean geometries, using Clifford algebras.