The code in this snippet if for DBPro but, it shows the simple math behind axis aligned rotation and should be easy to port to agk. I use, user defined types in the demo. You can also use vector and matrix math, if available in agk or use arrays.

type t_Vector
x as float
y as float
z as float
w as float
endtype
type t_Matrix
m00 as float
m01 as float
m02 as float
m10 as float
m11 as float
m12 as float
m20 as float
m21 as float
m22 as float
endtype
axisRot as t_Vector
axisRot.x = 1
axisRot.y = 1
axisRot.z = 1
axisRot.w = 0
sync on
sync rate 60
backdrop on
color backdrop 0
autocam off
position camera 0, 0, -100
make object cube 1, 20
do
AxisRotateObject(1, axisRot)
sync
axisRot.w = wrapvalue(axisRot.w+1)
loop
end
function AxisRotateObject(objID as integer, axisAngle as t_Vector)
local c as float
local s as float
local t as float
local x as float
local y as float
local z as float
local mag as float
local matRot as t_Matrix
` normalize axis vector
x = axisAngle.x
y = axisAngle.y
z = axisAngle.z
mag = sqrt(x*x+y*y+z*z)
x = x/mag
y = y/mag
z = z/mag
` set angle variables
c = cos(axisAngle.w)
s = sin(axisAngle.w)
t = 1-c
` build rotation matrix
matRot.m00 = t*x*x+c
matRot.m01 = t*x*y+s*z
matRot.m02 = t*x*z-s*y
matRot.m10 = t*x*y-s*z
matRot.m11 = t*y*y+c
matRot.m12 = t*y*z+s*x
matRot.m20 = t*x*z+s*y
matRot.m21 = t*y*z-s*x
matRot.m22 = t*z*z+c
` if agk uses a right handed rotation matrix you will
` need to built the matrix transpose
` m00 = m00 : m01 = m10 : m02 = m20
` m10 = m01 : m11 = m11 : m12 = m21
` m20 = m02 : m21 = m12 : m22 = m22
` get euler angles from matrix
x = atanfull(matRot.m12, matRot.m22)
y = -asin(matRot.m02)
z = atanfull(matRot.m01, matRot.m00)
` check gimbal lock
if (matRot.m02>0.99999)
x = atanfull(matRot.m10, matRot.m20)
y = -90.0
z = 0.0
endif
if (matRot.m02<-0.99999)
x = atanfull(matRot.m10, matRot.m20)
y = 90.0
z = 0.0
endif
` rotate object
rotate object objID, x, y, z
endfunction