When their potty habits change all of a sudden, the first thing I think of is medical issues. Please take her to the vet to first rule out any UTI or other issue.
Then if that checks out, has there been any change in her day to day routine? Have you moved, has anyone moved in, family changes, etc??? Schedule the same?
I do not believe they potty out of spite or being mad
When you are scolding her for going on the rug, are you catching her in the act or are you finding it then "scolding" her? (For what its worth, I don't believe in scolding, I think just a "look" tells them you are dissapointed. )
There is almost always a "reason" when your furbaby changes their potty habbits after being completly housebroken and trustworthy.If you can think back and track to when she started to stray you might find the reason, if it is not medical.