Use an anonymous function:
The problem with what you're doing is that you have to pass a function reference to setInterval. In what you posted, setInterval is getting the result of the rotate function (i.e. what it returns) - which could be nothing at all. It would work if you did this:
but since you want to pass it an argument, you need to wrap it in an anonymous function. Then setInterval will execute that function every 6s.