The G68 command allows you to take your original code and rotate your geometry with just one simple line of code.