I am running Buster on a rPi 3B+. I added the official 7" touchscreen. In my case I need to orient the screen to be portrait, i.e., rotated 90 degrees. I too ran into the problem of have the touchscreen correctly calibrated. Ultimately, I identified the correct XINPUT command to adjust the screen:
xinput --set-prop 'raspberrypi' 'Coordinate Transformation Matrix' 0 1 0 -1 0 1 0 0 1
And, just like a number of people had difficulty getting the above command to run directly after booting the rPi. To get this command to run I created xinstart.sh on my desktop and added the above xinput command to that file. To be able to execute that script, enter the following:
sudo chmod +x /home/pi/Desktop/xinstart.sh
I then added a line at the end of the file autostart to execute the script xinstart.sh as follows:
It does work but it is important to find the right script in the right directory.
I am posting this since has been the most frustrating thing I have had to address on the rPi.