If a company were to grant me RSU's in an entity not based in the US, are their differences in how this would affect my taxes compared to if those RSU's were for a US-based company? Do I owe taxes to this foreign country, to the United States, or both? I'm having a hard time finding an answer online.
Additionally, if I were to immediately sell the RSU's back to the company for cash, what are the tax ramifications of doing so? Based on my understanding, it seems like I would just owe taxes on the capital gains (the total value of the RSU). But again, to what country do I actually owe the taxes?
For context, I have some stocks in Canadian companies, and every year when I file my 1099-DIV, foreign taxes are paid on the dividends to Canada and I get a credit for foreign tax paid from the IRS.