If we go back to the EU-PT literal translations first . . .
Using the mnemonic - "This" and "these" both have " t's ", for "that" and "those" out it goes.
Practical usage in PT-BR may vary on these rules but if you use them in any PT speaking country, you won't go far wrong.
It is interesting to note that in Latin there are not 3 pronouns as there are in Portuguese. They only have iste and ille (and inflections). Where 'ille' will generally be used for "aquilo" (and inflections), I seem to remember there were some nuances to the meaning of 'iste', even showing contempt iirc. In any case, I think that is the ancestor of both 'isto' and 'isso' (and inflections).