Anythings possible, but not always recomended.
The work required to convert over to the Mazda engine and trans wouldnt be worth the money you might save by not rebuilding.
Start with custom engine and trans mounts relocated to fit frame/engine, then a custom clutch linkage, throttle linkage, custom length driveshafts with Toyota u joint on one end and Mazda on the other.
Wire harness matching for engine and dash gauges.
And many other custom touchs to get everything working right.
Ive put 2 non-Toyota engines in 84 to 88 model Toyota trucks, a Buick Type T turbo engine with matching 4spd auto and early 70's 73/4" Chevelle r/r axle, and a 1990 twin turbo RX7 Rotory engine and matching auto trans.
Both were a challenge and so many bugs to work out I swore I'd never attempt swaps like that again.