it does not work in general, but it is a starting point:
// only test code...
// does only work in a few cases...
var obj = document.selectedItems;
var center = obj.bounds.center;
var corner1 = obj.curves.point1;
var corner2 = obj.curves.point1;
var refPoint = new Point(corner2.x,corner1.y);
var ak = refPoint.getDistance(corner2);
var gk = refPoint.getDistance(corner1);
var tan = gk / ak;
var angle = Math.atan(tan);
var refRect = document.createRectangle(Rectangle(0, 0, 50, 50));
look at these for some explanation: http://img518.imageshack.us/img518/9151/rotatell2.gif
i think there is a better way to go, but this was my first idea how to solve the problem.
i'd like to see other solutions...