I Have A Grammar Question I Have Been Told That If A Sentence Ends With A Word Or Ph 2843413

I have a grammar question. I have been told that if a sentence ends with a word or phrase in quotations, the punctuation should always be placed inside the quotes. Is this true? I can’t understand how that works in sentences like this:
Did you not hear me say “I’m going to the store?”
It makes it sound like the quote is a question when it’s a declarative statement. Also awkward is when there’s punctuation in a title, like:
Have you heard the song called “Everything Matters!”?
Seems very awkward. What are the rules on this?