Changed getQuaternion function to fix a error with negative values

Signed-off-by: Wilco van den Brink <wilco.vandenbrink@outlook.com>