I ended solving this, by realizing that this wasn't a code issue. It was me being a dummy issue. I was calling sqlcmd on the remote host, but forgot to add the instance!
The variables were being declared and read correctly all along!