Fix rewrite for eliminating constant factors of PI from argument to sine (#8031)