Added AMD support, added value checking of translation in cases where scaleX and scaleY produce NaN or Infinity values