Maybe it's not simpler, but sure is more elegant...
You could use matrix with rotated coordinate system and then multiply each vector of p3, p4, p5 with it to get new coordinates... You can also acquire this result by setting UCS for Sample A rectangle (translated WCS to UCS at p1) and use (trans) function to translate point coordinates from WCS to UCS at p1 - you use (trans p 0 1) and finally from those resulting points in UCS (translated) to WCS, but previously set new Sample B UCS (rotated) - you then use (trans p-"sampleA-previousUCS(translated)" 1-"sampleB-UCS(rotated)" 0)...