In this paper, we investigate a system of twelve quaternion matrix equations. Using the real representation of a quaternion matrix, we first derive the least-squares solution with the least norm to the system. Meanwhile, we establish the solvability conditions and an expression of the general solution to the system when it is consistent