Читайте про матрицы.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<style>
body{
background: #202020;
}
div.rect {
width: 50px;
height: 50px;
background: yellow;
}
</style>
</head>
<body>
<div class="rect" id="rotate-rect"></div>
<script>
var rect = document.getElementById('rotate-rect');
var a = 1, b = 0, c = 0, d = 1, tx = 10, ty = 10, angle = 0, currentAngle;
function getAngleToRAD(){
if(angle === 360){
angle = 0;
}
return angle++ * Math.PI / 180;
}
function update(){
currentAngle = getAngleToRAD();
rect.style.transform = 'matrix(' + Math.cos(currentAngle) + ',' + Math.sin(currentAngle) + ',' + -Math.sin(currentAngle) + ',' + Math.cos(currentAngle) + ',' + tx + ',' + tx + ')'
window.requestAnimationFrame(update);
}
update();
</script>
</body>
</html>